20 KEY OFF: WIDTH 40: SCREEN ,1
21 REM esta linea esta agregada para setar controlador de video
22 A=1:B=&H2D:C=&H1C:D=124
30 FOR K=1 TO 10: KEY K,"": NEXT K
137 GOSUB 6020
140 DIM NAM$(4),PLAYER(4)
150 COMMON NAM$(),PLAYER(),CURRENT,PEOPLE,PRMTXT,SECTXT,TRITXT
160 FOR I=1 TO 4
170     PLAYER(I)=5000: NAM$(I)=""
180 NEXT
190 CURRENT=0
207 IF TRITXT=0 OR TRITXT=7 THEN BAKGRD3=7:INPUTCOL=1:WRONG=4 ELSE BAKGRD3=0:INPUTCOL=7:WRONG=7
209 CLS:COLOR 0,1
210 LOCATE 1,11:PRINT "                    "
211 LOCATE 2,11:PRINT "  JUEGO DEL CASINO  "
212 LOCATE 3,11:PRINT "                    "
215 COLOR INPUTCOL,BAKGRD3,BAKGRD3
220 LOCATE 7,6: PRINT "En este juego, hasta 4 (cuatro)"
230 LOCATE 9,5: PRINT "jugadores pueden entrar al Casino."
240 LOCATE 12,6,1: PRINT "Cuanta gente entrara hoy ? ";
245 LOCATE 22,5:PRINT "Tipee 0 para finalizar JUEGO1"
246 LOCATE 12,33,1
260 ANS$=INKEY$: IF ANS$<>"" THEN 260
270 ANS$=INKEY$: IF ANS$=""  THEN 270
275 IF ANS$="0" THEN SYSTEM
280 PEOPLE=VAL(ANS$): IF PEOPLE<1 OR PEOPLE>4 THEN SOUND 400,4: GOTO 270
290 PRINT ANS$: CLS
300 LOCATE 12,3: PRINT "Por favor ingrese su 1er. nombre. "
310 LOCATE 13,3: PRINT "Hasta un maximo de 8 letras    :"
320 IF PEOPLE>1 THEN 340
330 CURRENT=1: GOSUB 1290: GOTO 420
340 FOR J=15 TO PEOPLE+14
350	CURRENT=J-14
360	LOCATE J,1
370     PRINT "Jugad."J-14" -> ";
380	GOSUB 1290
390 NEXT
400 CURRENT=CURRENT+1: IF CURRENT>PEOPLE THEN CURRENT=1
410 REM **  returning from games  **
420 IF TRITXT=0 OR TRITXT=7 THEN BAKGRD2=1 ELSE BAKGRD2=0
425 COLOR 7,BAKGRD2,BAKGRD2:CLS
430 IF PEOPLE>1 THEN 450
440 LOCATE 12,1,0: PRINT NAM$(1): LOCATE 13,2,0: A$=STR$(PLAYER(1)): A$=RIGHT$(A$,LEN(A$)-1): PRINT "$"A$: GOTO 485
450 LOCA=7
460 FOR J=1 TO PEOPLE
470	LOCATE LOCA,1,0: PRINT NAM$(J): LOCATE LOCA+1,2,0: A$=STR$(PLAYER(J)):		A$=RIGHT$(A$,LEN(A$)-1): PRINT "$"A$: LOCA=LOCA+3
480 NEXT
485 IF TRITXT=0 OR TRITXT=7 THEN BAKGRD=4 ELSE BAKGRD=0
490 COLOR 7,BAKGRD: LOCATE 3,10,0: PRINT STRING$(29,36)
500 FOR I=4 TO 21
510	LOCATE I,10,0: PRINT STRING$(2,36)+SPACE$(25)+STRING$(2,36)
520 NEXT
530 LOCATE 22,10,0: PRINT STRING$(29,36)
540 COLOR 7,BAKGRD,BAKGRD2
545 LOCATE 5,22,0:PRINT "MENU"
550 LOCATE 7,14,0 : PRINT "1 => BLACKJACK"
560 LOCATE 9,14,0 : PRINT "2 => TRAGAMONEDAS"
570 LOCATE 11,14,0 : PRINT "3 => POKER"
575 IF PEOPLE=1 THEN 590
580 LOCATE 13,14,0: PRINT "P => Pasa su turno "
590 IF PRMTXT=10 OR PRMTXT=7 THEN COLOR 14 ELSE COLOR 6
595 LOCATE 15,14,0: PRINT "S => Comienza de nuevo"
600 LOCATE 18,14,0: COLOR BAKGRD,BAKGRD: PRINT SPACE$(23)
610 LOCATE 19,14,0: PRINT SPACE$(23)
620 LOCATE 20,14,0: PRINT SPACE$(23)
630 LOCATE 18,14,0: COLOR 7,BAKGRD: PRINT NAM$(CURRENT)", cual juego": LOCATE 19,14: PRINT "desea Usted jugar  ?   ";: LOCATE 19,35,1
640 GAM$=INKEY$: IF GAM$<>"" THEN 640
650 GAM$=INKEY$: IF GAM$=""  THEN 650
660 IF GAM$="P" OR GAM$="p" THEN IF PEOPLE=1 THEN 730 ELSE CURRENT=CURRENT+1: IF CURRENT>PEOPLE THEN CURRENT=1: GOTO 600 ELSE GOTO 600
670 IF GAM$="s" OR GAM$="S" THEN 160
680 GAM=VAL(GAM$): IF GAM<1 OR GAM>3 THEN SOUND 400,4: GOTO 650 ELSE PRINT GAM$: LOCATE 10,1,0
685 COLOR 31,BAKGRD2
690 IF GAM = 1 THEN IF PLAYER(CURRENT)>=10 THEN CHAIN "BLACMAR1"
695 IF GAM = 1 THEN LOCATE 24,9,0:COLOR 15,BAKGRD2:PRINT NAM$(CURRENT)", Necesita al menos";:LOCATE 25,9:PRINT "$10 p/jugar blackjack.";:FOR I=1 TO 3000:NEXT:FOR I=24 TO 25:LOCATE I,1:COLOR BAKGRD2:PRINT SPACE$(39);:NEXT:GOTO 630
700 IF GAM = 2 THEN CHAIN "SLOTMAR1"
710 IF GAM = 3 THEN IF PLAYER(CURRENT)>=30 THEN CHAIN "POKEMAR1"
720 IF GAM = 3 THEN LOCATE 24,9,0: COLOR 15,BAKGRD2: PRINT NAM$(CURRENT)", Necesita al menos";: LOCATE 25,11: PRINT "$30 p/jugar poker.";: FOR I=1 TO 3000: NEXT: FOR I=24 TO 25: LOCATE I,1: COLOR BAKGRD2: PRINT SPACE$(39);: NEXT: GOTO 630
730 SOUND 400,4:GOTO 620
1030 REM **********************************************************
1040 REM ** SUBROUTINE TO ERASE PLAYER'S NAME AND CRUNCH UP REST **
1050 REM **********************************************************
1060 IF TRITXT=0 OR TRITXT=7 THEN COLOR 1,7,7:CLS ELSE COLOR 7,0,0:CLS
1061 DEF SEG=&H40:RANDOMIZE PEEK(&H6D)*256!+PEEK(&H6C)-32768!
1062 XX=INT(RND*3)+1
1065 EXIT=0
1066 ON XX GOSUB 10000,10100,10200
1100 IF PEOPLE-1=0 THEN LOCATE 16,1: PRINT "Gracias por jugar. ": EXIT=1: GOTO 1250
1103 GOTO 1113
1105 IF TRITXT=0 OR TRITXT=7 THEN COLOR 1,7,7:CLS:EXIT=0 ELSE COLOR 7,0,0:CLS:EXIT=0
1106 DEF SEG=&H40:RANDOMIZE PEEK(&H6D)*256!+PEEK(&H6C)-32768!
1107 XX=INT(RND*3)+1
1108 ON XX GOSUB 11000,11100,11200
1112 IF PEOPLE-1=0 THEN LOCATE 16,1: PRINT "Gracias por jugar. ": EXIT=1: GOTO 1250
1113 IF CURRENT=PEOPLE THEN PEOPLE=PEOPLE-1: CURRENT=1: GOTO 1170
1120 FOR I=CURRENT TO PEOPLE-1
1130	NAM$(I)=NAM$(I+1)
1140	PLAYER(I)=PLAYER(I+1)
1150 NEXT
1160 PEOPLE=PEOPLE-1
1170 LOCATE 17,1
1180 IF PEOPLE=1 THEN PRINT "Ahora, solo "NAM$(1)" esta jugando."
1190 IF PEOPLE=2 THEN PRINT "Ahora, solo "NAM$(1)" y "NAM$(2)" estan jugando."
1200 IF PEOPLE=3 THEN PRINT "Ahora, solo "NAM$(1)", "NAM$(2)", y"
1210 IF PEOPLE=3 THEN LOCATE 18,1: PRINT NAM$(3)" estan jugando."
1220 FOR I=PEOPLE+1 TO 4
1230	NAM$(I)=""
1240 NEXT
1250 LOCATE 21,1: PRINT "Presione "+CHR$(17)+CHR$(196)+CHR$(217)+" p/ continuar.."
1255 ANS$=INKEY$: IF ANS$<>"" THEN 1255
1260 ANS$=INKEY$: IF ANS$="" THEN 1260
1265 IF ANS$<>CHR$(13) THEN SOUND 400,4: GOTO 1260
1270 IF EXIT=0 THEN 420 ELSE 160
1280 REM *****************************************
1290 REM **  SUBROUTINE TO INPUT PLAYER'S NAME  **
1300 REM *****************************************
1310 LOCATE CURRENT+14,14: PRINT SPACE$(24): LOCATE CURRENT+14,14,1
1320 ANS$=INKEY$: IF ANS$<>"" THEN 1320
1330 ANS$=INKEY$: IF ANS$=""  THEN 1330
1340 ASCII=ASC(ANS$)
1350 IF ASCII=13 THEN IF NAM$(CURRENT)="" THEN 1410 ELSE 1450
1370 IF ASCII=32 THEN LOCATE 24,8,0: SOUND 400,4: COLOR WRONG: PRINT "Solo el primer nombre.  ";: FOR I=1 TO 2000: NEXT: LOCATE 24,8: COLOR BAKGRD3: PRINT "                        ";: NAM$(CURRENT)="": COLOR INPUTCOL: GOTO 1310
1380 IF (ASCII>64) AND (ASCII<91) THEN ASCII=ASCII+32: GOTO 1415
1390 IF (ASCII>96) AND (ASCII<123) THEN 1415
1400 IF ASCII=8 OR ANS$=CHR$(0)+CHR$(75) THEN IF NAM$(CURRENT)="" THEN 1410 ELSE W=POS(0): LOCATE CURRENT+14,W-1,0: NAM$(CURRENT)=LEFT$(NAM$(CURRENT),(LEN(NAM$(CURRENT))-1)): PRINT " ": LOCATE CURRENT+14,W-1,1: GOTO 1330
1410 SOUND 400,4: GOTO 1330
1415 IF LEN(NAM$(CURRENT))=8 THEN 1460
1420 IF LEN(NAM$(CURRENT))=0 THEN ASCII=ASCII-32: NAM$(CURRENT)=CHR$(ASCII): GOTO 1440
1430 NAM$(CURRENT)=NAM$(CURRENT)+CHR$(ASCII)
1440 PRINT ANS$;: GOTO 1330
1450 IF (LEN(NAM$(CURRENT))>0) AND (LEN(NAM$(CURRENT))<9) THEN RETURN
1460 LOCATE 23,7,0: SOUND 400,4: COLOR WRONG: PRINT "Perdon, hay un maximo de ";
1470 LOCATE 24,7,0: PRINT "8 letras para su nombre.   ";: FOR I=1 TO 2000: NEXT: COLOR BAKGRD3: LOCATE 23,1: PRINT SPACE$(39);: LOCATE 24,1: PRINT SPACE$(39);: NAM$(CURRENT)="": COLOR INPUTCOL: GOTO 1290
6000 DEF SEG=0
6010 A=PEEK(&HE000):B=PEEK(&HE001):C=PEEK(&HE002):D=PEEK(&HE004)
6020 OUT 980,2:OUT 981,B
6030 OUT 980,7:OUT 981,C
6040 IF A=1 THEN PRMTXT=7:SECTXT=7:TRITXT=10:RETURN
6050 IF D=1 THEN PRMTXT=1:SECTXT=4:TRITXT=0 ELSE PRMTXT=10:SECTXT=7:TRITXT=7
6060 RETURN
9999 SAVE"rstart": PRINT "Rstart.bas  Rescatado": END
10000 GOSUB 50060:LOCATE 10,1: PRINT NAM$(CURRENT)", Usted no tiene mas dinero.    "
10010 LOCATE 12,1: PRINT "Voy a tener que llamar a un guardia  "
10020 LOCATE 13,1: PRINT "para que lo lleve fuera del Casino.   "
10030 RETURN
10100 GOSUB 50060:LOCATE 10,1:PRINT "Perdon "NAM$(CURRENT)", ha perdido su ultimo "
10110 LOCATE 11,1:PRINT "Peso y no le extendemos mas credito.  "
10120 LOCATE 13,1:PRINT "Vayase y no regrese por esta noche."
10130 RETURN
10200 GOSUB 50060:LOCATE 10,1:PRINT NAM$(CURRENT)", Ha quebrado!!! "
10210 LOCATE 12,1:PRINT "Regrese pronto y traiga mas   "
10220 LOCATE 13,1:PRINT "dinero cuando lo haga."
10230 RETURN
11000 GOSUB 60050:LOCATE 8,1: PRINT NAM$(CURRENT)", ha hecho saltar la banca"
11010 PRINT "y ahora es suya una parte del Casino."
11020 PRINT "Como Ud. ahora es un empleado del"
11030 PRINT "establecimiento, no puede jugar mas."
11040 PRINT "No se sienta mal, recuerde que desde"
11050 PRINT "ahora es un Millonario !!!."
11060 RETURN
11100 GOSUB 60050:LOCATE 10,1:PRINT "Felicitaciones  "NAM$(CURRENT)", ha "
11110 LOCATE 11,1:PRINT "hecho saltar la banca! Como se siente  "
11120 LOCATE 12,1:PRINT "ser un Millonario ??"
11130 LOCATE 13,1:PRINT "Regrese cuando lo desee."
11140 RETURN
11200 GOSUB 60050:LOCATE 10,1:PRINT "Ha hecho saltar la banca "NAM$(CURRENT)"."
11210 LOCATE 12,1:PRINT "Recuerde cambiar sus fichas por "
11220 LOCATE 13,1:PRINT "dinero antes de retirarse."
11230 RETURN
40030 LOCATE 13,16:PRINT "ÜÜ    ÜÜ"
40040 LOCATE 14,16:PRINT "  ßÜÜß  "
40050 FOR I=1 TO 100:NEXT
40060 LOCATE 13,16:PRINT "         "
40070 LOCATE 14,16:PRINT "ßßßÜÜßßß"
40080 FOR I=1 TO 100:NEXT
40090 LOCATE 14,16:PRINT "ÜÜÜÜÜÜÜÜ"
40100 FOR I=1 TO 100:NEXT
40110 LOCATE 14,16:PRINT"   ÜÜ   "
40120 LOCATE 15,16:PRINT"ßßß  ßßß"
40130 FOR I=1 TO 100:NEXT
40140 LOCATE 14,16:PRINT"   ÜÜ   "
40150 LOCATE 15,16:PRINT"ÜÜß  ßÜÜ"
40160 FOR I=1 TO 100:NEXT
40170 LOCATE 14,16:PRINT"   ÜÜ   "
40180 LOCATE 15,16:PRINT" Üß  ßÜ "
40190 LOCATE 16,16:PRINT"ß      ß"
40200 RETURN
50000 '***********************************************************
50010 '*                                                         *
50020 '*              POOOOOOR HOUSE ROUTINE - K.J.F.            *
50030 '*                                                         *
50040 '***********************************************************
50050 '
50060 'CLS
50070 A=LEN(NAM$(CURRENT))
50080 A1=8-A:BOO$=SPACE$(A1/2)+NAM$(CURRENT)
50100 PRINT"                                       "
50110 PRINT"                                       "
50120 PRINT"               ÜÜÜßßÜÜÜ               "
50130 PRINT"          ÜÜßßß        ßßßÜÜ          "
50140 PRINT"         Û                  Û         "
50150 PRINT"        Û                    Û        "
50160 PRINT"       Üß                    ßÜ       "
50170 PRINT"       Û     ÜßßÜ    ÜßßÜ     Û       "
50180 PRINT"      Üß                      ßÜ      "
50190 PRINT"      Û                        Û      "
50200 PRINT"      Û          Û  Û          Û      "
50210 PRINT"      Û           ßß           Û      "
50220 PRINT"      Û        ßÜ    Üß        Û      "
50230 PRINT"       Û         ßÜÜß         Û       "
50240 PRINT"       ßÜ                    Üß       "
50250 PRINT"        Û                    Û        "
50260 PRINT"         Û                  Û         "
50270 PRINT"          ßßÜÜÜ        ÜÜÜßß          "
50280 PRINT"               ßßßÜÜßßß               "
50290 PRINT:PRINT
50300 PRINT"               ";BOO$;:
50310 PLAY"MB MS O2 T200 L4 D# D#8 C F8 D#3 C4"
50320 LOCATE 14,1
50325 FOR I=1 TO 500:NEXT:GOSUB 40030
50330 FOR I=1 TO 1000:NEXT
50340 PLAY "O1 D# P10 G#"
50350 FOR I=1 TO 1800:NEXT:CLS:RETURN
60000 '*************************************************************
60010 '*                                                           *
60020 '*             BREAK BANK ROUTINE -KJF                       *
60030 '*                                                           *
60040 '*************************************************************
60050 OUT &H61,INP(&H61)OR &H80:COLOR 7,0,0:CLS
60060 WIDTH 40:LOCATE ,,0
60070 FOR P=1 TO 7:RESTORE 60100:T=P*100
60080 FOR I=1 TO 4:READ S,D:SOUND S+T,D:NEXT:NEXT
60090 GOTO 60110
60100 DATA 1000,1,500,1,200,1,1000,1
60110 PLAY"MF"
60120 FOR D=1 TO 50:I=RND*30+1:FOR C=0 TO 2:SOUND I*100+C,.01:NEXT:COLOR (RND*15):LOCATE (RND*24)+1,(RND*38)+1:PRINT"$";:NEXT:SOUND 10000,0
60130 COLOR 7,0,0
60140 FOR I=100 TO 3000 STEP 10:SOUND I,.01:NEXT:SOUND I,0
60150 FOR C=1 TO 7:FOR I=3000 TO 100 STEP -300:SOUND I,.1:NEXT:NEXT
60160 FOR C=1 TO 4:FOR I=400 TO 1000 STEP 10:SOUND I,.1:NEXT:SOUND I,0:NEXT
60170 FOR D=1 TO 25:I=RND*30+1:FOR C=0 TO 2:SOUND I*100+C,.01:NEXT:COLOR (RND*15):LOCATE (RND*24)+1,(RND*38)+1:PRINT"$";:NEXT:SOUND 10000,0
60180 PLAY "O3 MN MB T200 L4 G G F8 E8 E D#8 E8 L8 E E F# G# E G# F#"
60190 FOR I=1 TO 140:LOCATE (RND*24)+1,(RND*38)+1:COLOR RND*15:PRINT"$";:NEXT
60200 FOR I=500 TO 1000 STEP 11:SOUND I,.01:NEXT:FOR I=500 TO 1000 STEP 11:SOUND I,.01:NEXT:FOR I=700 TO 1500 STEP 11:SOUND I,.01:NEXT:FOR I=I TO 57 STEP -20:SOUND I,.01:NEXT:SOUND I,0
60210 PLAY "MB L8 T200 O4 F# F E16 F16 E16 D#16 D C# C C#"
60220 FOR I=500 TO 2000 STEP 5:SOUND 1000+I,.1:SOUND 500+I,.1:SOUND 200+I,.1:NEXT:SOUND 1000,0
60230 RESTORE 60240:P=2:PLAY "MF":FOR I=1 TO 10:READ S,D:SOUND S,D:LOCATE P,(RND*39)+1:COLOR 9+RND*6:PRINT NAM$(CURRENT);:SOUND 32767,1:P=P+2:NEXT
60240 DATA 700,6,785,4.5,700,1.5,590,6,590,6,590,4.5,525,1.5,590,4.5,623,1.5,590,6
60250 CLS:COLOR 12:FOR I=1 TO 10:LOCATE 12,19+I:PRINT"$";:LOCATE 12,19-I:PRINT"$";:LOCATE 12-I,19:PRINT"$";:LOCATE 12+I,19:PRINT"$";:LOCATE 12-I,19-I:PRINT"$";:LOCATE 12+I,19+I:PRINT"$";:LOCATE 12-I,19+I:PRINT"$";:LOCATE 12+I,19-I:PRINT"$";:NEXT
60260 PLAY "MB":FOR C=500 TO 2600 STEP 100:FOR I=500 TO 1000 STEP 40:SOUND I+C,.1:NEXT:NEXT:SOUND I,0
60270 FOR I=1 TO 1000:NEXT
60280 IF TRITXT=0 OR TRITXT=7 THEN COLOR 1,7,7 ELSE COLOR 7,0,0
60290 CLS:OUT &H61,INP(&H61)AND &H7F:RETURN
